define(['app'], function(app) {
	'use strict';

	var controller = function controller($scope, Previewamount, $ionicSlideBoxDelegate, $window, $timeout,GoPage) {
		
		$scope.selectTab = 0;
		$scope.activeTab = function(index) {
			$scope.selectTab = index;
			$ionicSlideBoxDelegate.$getByHandle('tab-handle').slide(index);
		};
	    //滑动切换
		$scope.slideChanged = function(index) {
			$scope.selectTab = index;
		};
		
		//画面加载
		$scope.$on('$ionicView.afterEnter', function() {
			//动态设置高度
			var all = $window.innerHeight;
			//计算滚动条
			$scope.myObj = {
				"height": all - 88 + "px"
			};
		}, false);
		
		//数据初始化
		$scope.init_data = function(){
			Previewamount.get_detail(function(data) {
				$scope.detail = data;
			});
		}
		$scope.init_data();
		
//		$scope.onshow_pro = function(){
//			GoPage.go_states("previewamountpro");
//		}
//		$scope.onshow_rank = function(){
//			GoPage.go_states("previewamountrank");
//		}


	}

	controller.$inject = ['$scope', 'Previewamount', '$ionicSlideBoxDelegate', '$window', '$timeout','GoPage'];

	return app.registerController("previewamountctrl",controller);
});